import { Column, Entity } from 'typeorm'
import { SoftCommonEntity } from '~/common/entity/common.entity'

@Entity({ name: 'c_setting_app_index' })
export class SettingAppIndexEntity extends SoftCommonEntity {
  @Column({ name: 'title', type: 'varchar', length: 255, comment: '首页资源标题', default: '' })
  title: string

  @Column({ name: 'cover_url', type: 'varchar', length: 255, comment: '封面图片Url', default: '' })
  coverUrl: string

  @Column({ name: 'resource_type', type: 'int', comment: '关联内容(1-视频 2-图书 3-习题)', default: 0 })
  resourceType: number

  @Column({ name: 'series_ids', type: 'json', comment: '关联内容对应的系列 { 内容值: [系列ids] }', default: [] })
  seriesIds: Array<[number, number]>

  @Column({ name: 'sort', type: 'int', comment: '排序', default: 1 })
  sort: number

  @Column({ name: 'visible', type: 'int', comment: '是否显示', default: 1 })
  visible: number

  // 非数据库字段，用于存储关联查询的标签名称
  tagName?: string
}
